import axios from 'axios'
import React, { Component } from 'react'
import '../../assets/css/detail/k-content.less'
export default class KContent extends Component {
    constructor(props) {
        super(props)
        this.state = {
            id: props.id,
            data: {}
        }
    }
    render() {
        return (
            <div className='k-content'>
                <h2>{this.state.data.title}</h2>
                <ul>
                    <li>{this.state.data.author}</li>
                    <li>{this.state.data.createTime}</li>
                </ul>
                <div className='article' dangerouslySetInnerHTML={{ __html: this.state.data.content }}></div>
            </div>
        )
    }
    async componentDidMount() {
        const resule = await axios.get('/data/article.json')
        const data = resule.data[0]
        console.log(data);
        this.setState({
            data
        })
    }
}
